package com.exam.meituan;

import java.util.ArrayList;
import java.util.Scanner;

/**
 * date:
 * description:
 */
public class Solution104 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int[] nums = new int[n];
        int[] classes = new int[k + 1];
        for (int i = 0; i < n; i++) {
            nums[i] = scanner.nextInt();
            classes[nums[i]]++;
        }
        int[] trainset = new int[k + 1];
        for (int i = 1; i <= k; i++) {
            trainset[i] = (classes[i] + 1) / 2;
        }
        ArrayList<Integer> trainIndex = new ArrayList<>();
        ArrayList<Integer> valIndex = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int ctype = nums[i];
            if(trainset[ctype] > 0){
                trainIndex.add(i + 1);
                trainset[ctype]--;
            } else {
                valIndex.add(i + 1);
            }
        }
        for (Integer index : trainIndex) {
            System.out.print(index + " ");
        }
        System.out.println();
        for (Integer index : valIndex) {
            System.out.print(index + " ");
        }
    }
}
